package com.huangfu.learning.javabase.java.pattern.create.abstractfactory;

/**
 * 宝马工厂类，覆盖所有宝马车型的构造方法  不能是抽象类
 */
public class BMWFactory extends AbstractFactoryCar {

    @Override
    Car getCar(String type) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Class clazz = Class.forName("com.huangfu.learning.javabase.java.pattern.create.abstractfactory."+type);
        return (BMWCar) clazz.newInstance();
    }
}
